package com.zjpavt.client.artnet.config;

import com.google.gson.*;
import com.google.gson.annotations.Expose;
import com.zjpavt.client.artnet.device.ColorConst;
import com.zjpavt.client.artnet.device.LightSystem;
import com.zjpavt.client.artnet.device.StripLight;
import com.zjpavt.client.artnet.effect.*;
import com.zjpavt.client.enums.ExtendDeviceEnum;
import com.zjpavt.client.event.EventRegisterCenter;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ConfigReader {
    private String eventName;
    private Map<String, String> parameter;
    private String stripLightName;
    private String effectJson;
    private String effectClass;
    private String nextEffectJson;
    private String nextEffectClass;
    private long outTime;

    @Expose
    private transient StripLight stripLight;

    public ConfigReader(String eventName, Map<String, String> parameter, StripLight stripLight) {
        Gson gson = new Gson();
        this.eventName = eventName;
        this.parameter = parameter;
        this.stripLight = stripLight;
        if (stripLight.getEffect() != null) {
            this.effectJson = gson.toJson(stripLight.getEffect());
            this.effectClass = stripLight.getEffect().getClass().getName();
        }
        this.outTime = stripLight.getOutTime();
        if (stripLight.getNextEffect() != null) {
            this.nextEffectClass = stripLight.getNextEffect().getClass().getName();
            this.nextEffectJson = gson.toJson(stripLight.getNextEffect());
        }
    }

    public static final String STRIP = LightSystem.STRIP_LIGHT;
    public static void main(String[] args) throws IOException {
        System.out.println("|");
        useFor1();
        useFor2();
        useFor3();

    }

    private static void useFor3() {
        Gson gson = new Gson();

//        String configText = FileUtil.readFromFile("/oldD/tempPavt/a.txt");
        List<ConfigReader> configReaders = new ArrayList<>();
        Map<String, String> map = new HashMap<>();
        ConfigReader configReader;
        StripLight stripLight;

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 22);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 23);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 24);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 25);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.CIRCUIT.getDeviceName());
        map.put(EventRegisterCenter.EXT_NUM, "2");
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,-0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,10,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 24);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.CIRCUIT.getDeviceName());
        map.put(EventRegisterCenter.EXT_NUM, "3");
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,-0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,10,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 22);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.DMX_512_SWITCH.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,-0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,10,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 23);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));


        System.out.println();
        System.out.println("3-------------------------");
        System.out.println(gson.toJson(configReaders));
        System.out.println("3-------------------------end");

    }

    private static void useFor2() {
        Gson gson = new Gson();

        List<ConfigReader> configReaders = new ArrayList<>();
        Map<String, String> map = new HashMap<>();
        ConfigReader configReader;
        StripLight stripLight;

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 11);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));


        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 12);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));


        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 13);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 14);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 15);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 16);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 17);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 18);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 19);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 20);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.AIR.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,-0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 11);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));


        System.out.println();
        System.out.println("2-------------------------");
        System.out.println(gson.toJson(configReaders));
        System.out.println("2-------------------------end");


    }

    private static void useFor1() {
        Gson gson = new Gson();

//        String configText = FileUtil.readFromFile("/oldD/tempPavt/a.txt");
        List<ConfigReader> configReaders = new ArrayList<>();
        Map<String, String> map = new HashMap<>();
        ConfigReader configReader;
        StripLight stripLight;

        /**
         * 只需要注册事件
         */
        map = new HashMap<>();
        stripLight = new StripLight();
        configReader = new ConfigReader(EventRegisterCenter.LOOP_CHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 5);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 2);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));



        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 3);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 6);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.LIGHT_INIT, map, stripLight);
        configReader.setStripLightName(STRIP + 8);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.GPS.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 1);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.CIRCUIT.getDeviceName());
        map.put(EventRegisterCenter.EXT_NUM, "2");
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,-0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,4,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 3);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.ELECT.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 4);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.CIRCUIT.getDeviceName());
        map.put(EventRegisterCenter.EXT_NUM, "0");
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,-0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 5);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));


        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.POWER.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight, ColorConst.GREEN10,30,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 6);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.TMP.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.BLUE10,ColorConst.WHITE10,10,0,0.25));
        stripLight.setNextEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,10,0,-0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DATA_EXCHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 8);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.GPS_LIGHT.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,30,0,-0.25));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCOVER, map, stripLight);
        configReader.setStripLightName(STRIP + 1);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.CIRCUIT.getDeviceName());
        map.put(EventRegisterCenter.EXT_NUM, String.valueOf(2));
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,3,0,-0.25));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCOVER, map, stripLight);
        configReader.setStripLightName(STRIP + 3);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.ELECT.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,30,0,-0.25));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCOVER, map, stripLight);
        configReader.setStripLightName(STRIP + 4);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.POWER.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,30,0,-0.25));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCOVER, map, stripLight);
        configReader.setStripLightName(STRIP + 6);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.DOOR_ALARM.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,30,0,-0.25));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCOVER, map, stripLight);
        configReader.setStripLightName(STRIP + 7);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.TMP.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SinWaveEffect(stripLight,ColorConst.GREEN10,30,0,-0.25));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCOVER, map, stripLight);
        configReader.setStripLightName(STRIP + 8);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.GPS.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SameColorEffect(stripLight,ColorConst.YELLOW10));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCONNECT, map, stripLight);
        configReader.setStripLightName(STRIP + 1);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.CIRCUIT.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SameColorEffect(stripLight,ColorConst.YELLOW10));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCONNECT, map, stripLight);
        configReader.setStripLightName(STRIP + 3);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.ELECT.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SameColorEffect(stripLight,ColorConst.YELLOW10));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCONNECT, map, stripLight);
        configReader.setStripLightName(STRIP + 4);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.POWER.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SameColorEffect(stripLight,ColorConst.YELLOW10));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCONNECT, map, stripLight);
        configReader.setStripLightName(STRIP + 6);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.DOOR_ALARM.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SameColorEffect(stripLight,ColorConst.YELLOW10));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCONNECT, map, stripLight);
        configReader.setStripLightName(STRIP + 7);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        map.put(EventRegisterCenter.DEVICE_NAME, ExtendDeviceEnum.TMP.getDeviceName());
        stripLight = new StripLight();
        stripLight.setEffect(new SameColorEffect(stripLight,ColorConst.YELLOW10));
        stripLight.setNextEffect(null);
        stripLight.setOutTimeNoChange(Long.MAX_VALUE);
        configReader = new ConfigReader(EventRegisterCenter.DEVICE_DISCONNECT, map, stripLight);
        configReader.setStripLightName(STRIP + 8);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        stripLight.setEffect(new SquareWaveEffect(stripLight, ColorConst.WHITE10, ColorConst.BLUE10, 10, 0,0.25));
        stripLight.setOutTimeNoChange(1000);
        configReader = new ConfigReader(EventRegisterCenter.DOOR_STATUS_CHANGE, map, stripLight);
        configReader.setStripLightName(STRIP + 7);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));

        map = new HashMap<>();
        stripLight = new StripLight();
        configReader = new ConfigReader(EventRegisterCenter.DOOR_STATUS_UPDATE, map, stripLight);
        configReader.setStripLightName(STRIP + 7);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReader));
        System.out.println();
        System.out.println("1-------------------------");
        System.out.println(gson.toJson(configReaders));
        System.out.println("1-------------------------end");
    }

    private static void test1(Gson gson, String configText, List<ConfigReader> configReaders, Map<String, String> map, ConfigReader configReader, StripLight stripLight) {
        String effect = gson.toJson(configReader);
        configReaders.add(configReader);
        StripLight stripLight1 = new StripLight();
        stripLight1.setEffect(new SinWaveEffect(stripLight, ColorConst.WHITE10,  10, 0,1));
        stripLight1.setNextEffect(new WaterWaveEffect(stripLight, ColorConst.GREEN10,ColorConst.WHITE10));
        stripLight1.setOutTime(1000);
        ConfigReader configReader2 = new ConfigReader("adf", map, stripLight1);

        configReaders.add(configReader2);
        configReaders.add(configReader);
        System.out.println(gson.toJson(configReaders));
        System.out.println();
        System.out.println(new Gson().toJson(configReader));
        String jsonString = new Gson().toJson(configReader);
        ConfigReader configReader1 = new Gson().fromJson(configText, ConfigReader.class);

        configReader1.getEventName();
        configReader1.getParameter();
        configReader1.getStripLightName();
        EffectFactory.getEffect(configReader1.getEffectClass(), configReader1.getEffectJson());
        EffectFactory.getEffect(configReader1.getNextEffectClass(), configReader1.getNextEffectJson());
        configReader1.getOutTime();
        System.out.println(gson.toJson(configReader1));
    }

    public String getEventName() {
        return eventName;
    }

    public void setEventName(String eventName) {
        this.eventName = eventName;
    }

    public Map<String, String> getParameter() {
        return parameter;
    }

    public void setParameter(Map<String, String> parameter) {
        this.parameter = parameter;
    }

    public String getStripLightName() {
        return stripLightName;
    }

    public void setStripLightName(String stripLightName) {
        this.stripLightName = stripLightName;
    }

    public String getEffectJson() {
        return effectJson;
    }

    public void setEffectJson(String effectJson) {
        this.effectJson = effectJson;
    }

    public String getEffectClass() {
        return effectClass;
    }

    public void setEffectClass(String effectClass) {
        this.effectClass = effectClass;
    }

    public String getNextEffectJson() {
        return nextEffectJson;
    }

    public void setNextEffectJson(String nextEffectJson) {
        this.nextEffectJson = nextEffectJson;
    }

    public String getNextEffectClass() {
        return nextEffectClass;
    }

    public void setNextEffectClass(String nextEffectClass) {
        this.nextEffectClass = nextEffectClass;
    }

    public long getOutTime() {
        return outTime;
    }

    public void setOutTime(long outTime) {
        this.outTime = outTime;
    }

    public StripLight getStripLight() {
        return stripLight;
    }

    public void setStripLight(StripLight stripLight) {
        this.stripLight = stripLight;
    }
}
